<?php

namespace shop\service;

use Yii;

class WechatService
{

    /**
     * 查看表中是否有存在已经注册的用户
     * @param $where
     * @return array|false
     */
    public function userOne($where)
    {
        $sql = "SELECT * FROM mini_collect_user WHERE {$where}";
        return Yii::$app->db->createCommand($sql)->queryOne();
    }

    /**
     * 插入一条提现用户
     * @param $map
     * @return int
     */
    public function registerUser($map)
    {
        return Yii::$app->db->createCommand()->insert('mini_collect_user', $map)->execute();
    }

    /**
     * 更新用户信息
     * @param $set
     * @param $where
     * @return int
     */
    public function userUpdate($set, $where)
    {
        $sql = "UPDATE mini_collect_user SET {$set} WHERE {$where}";
        return Yii::$app->db->createCommand($sql)->execute();
    }
}